﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="myWorkOrder.aspx.cs" Inherits="WorkOrder.myWorkOrder" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <link href="../css/left.css" type="text/css" rel="STYLESHEET" />
    <link href="../css/site2.css" type="text/css" rel="STYLESHEET" />
    <script type="text/javascript" src="../DatePicker/WdatePicker.js" defer="defer"></script>
    <script language="javascript" type="text/javascript">        //加在head中，PNG无灰色背景
        var tmp = window.navigator.userAgent.toLowerCase().indexOf("MSIE");
        //加在head中，PNG无灰色背景
        function correctPNG() {
            for (var i = 0; i < document.images.length; i++) {
                var img = document.images[i];
                var imgName = img.src.toUpperCase();
                if (imgName.substring(imgName.length - 3, imgName.length) == "PNG") {
                    var imgID = (img.id) ? "id='" + img.id + "' " : "";
                    var imgClass = (img.className) ? "class='" + img.className + "' " : "";
                    var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' ";
                    var imgStyle = "display:inline-block;" + img.style.cssText;
                    if (img.align == "left") imgStyle = "float:left;" + imgStyle;
                    if (img.align == "right") imgStyle = "float:right;" + imgStyle;
                    if (tmp >= 1) {
                        if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle;
                    }
                    else {
                        if (img.parentNode.href) imgStyle = "cursor:hand;" + imgStyle;
                    }
                    var strNewHTML = "<span " + imgID + imgClass + imgTitle + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
       + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader" + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>";
                    img.outerHTML = strNewHTML;

                }
            }
        }

        if (window.addEventListener) {
            window.addEventListener('DOMContentLoaded', correctPNG, false);   //firefox
            window.addEventListener('load', correctPNG, false);
        } else if (window.attachEvent) {
            window.attachEvent('onload', correctPNG);  //IE
        }
    </script>
    <script type="text/javascript">
        String.prototype.trim = function () {
            // 用正则表达式将前后空格，用空字符串替代。
            return this.replace(/(^\s*)|(\s*$)/g, "");
        }

        function inputValidate() {
            var dateFormat = /^[0-9]{4}-(((0[13578]|(10|12))-(0[1-9]|[1-2][0-9]|3[0-1]))|(02-(0[1-9]|[1-2][0-9]))|((0[469]|11)-(0[1-9]|[1-2][0-9]|30)))$/;
            var a = document.getElementById("txtSTART_DATE").value;
            var b = document.getElementById("txtEND_DATE").value;
            if (a != "" || b != "") {
                if (!dateFormat.exec(a) || !dateFormat.exec(b)) {
                    alert("时间格式错误！");
                    return false;
                }
            }
            return true;
        }

        function setCreateTime() {
            if (document.getElementById("txtOrderNo").value.trim() != "") {
                var tmpstr1 = document.getElementById("txtOrderNo").value.trim().substr(13, 4);
                var tmpstr2 = document.getElementById("txtOrderNo").value.trim().substr(17, 2);
                var tmpstr3 = document.getElementById("txtOrderNo").value.trim().substr(19, 2);
                document.getElementById("txtSTART_DATE").value = tmpstr1 + "-" + tmpstr2 + "-" + tmpstr3;
                document.getElementById("txtEND_DATE").value = tmpstr1 + "-" + tmpstr2 + "-" + tmpstr3;
            }
        }

        var arrZhongqu = new Array(); //2
        arrZhongqu[0] = new Array('大岭山', '6');
        arrZhongqu[1] = new Array('大朗', '7');
        arrZhongqu[2] = new Array('黄江', '8');
        arrZhongqu[3] = new Array('常平', '9');
        arrZhongqu[4] = new Array('东坑', '28');

        var arrChengqu = new Array(); //1
        arrChengqu[0] = new Array('万江', '1');
        arrChengqu[1] = new Array('南城', '2');
        arrChengqu[2] = new Array('东城', '3');
        arrChengqu[3] = new Array('莞城', '4');
        arrChengqu[4] = new Array('松山湖', '5');

        var arrDongqu = new Array(); //3
        arrDongqu[0] = new Array('凤岗', '10');
        arrDongqu[1] = new Array('塘厦', '11');
        arrDongqu[2] = new Array('清溪', '12');
        arrDongqu[3] = new Array('谢岗', '13');
        arrDongqu[4] = new Array('樟木头', '14');
        arrDongqu[5] = new Array('桥头', '31');

        var arrNanqu = new Array(); //4
        arrNanqu[0] = new Array('虎门', '15');
        arrNanqu[1] = new Array('长安', '16');
        arrNanqu[2] = new Array('沙田', '23');

        var arrXiqu = new Array(); //5
        arrXiqu[0] = new Array('中堂', '17');
        arrXiqu[1] = new Array('望牛墩', '18');
        arrXiqu[2] = new Array('麻涌', '19');
        arrXiqu[3] = new Array('高埗', '20');
        arrXiqu[4] = new Array('道滘', '21');
        arrXiqu[5] = new Array('洪梅', '22');
        arrXiqu[6] = new Array('厚街', '24');

        var arrBeiqu = new Array(); //6
        arrBeiqu[0] = new Array('石碣', '25');
        arrBeiqu[1] = new Array('石龙', '26');
        arrBeiqu[2] = new Array('石排', '27');
        arrBeiqu[3] = new Array('寮步', '29');
        arrBeiqu[4] = new Array('横沥', '30');
        arrBeiqu[5] = new Array('茶山', '32');
        arrBeiqu[6] = new Array('企石', '33');

        function resetSelectByArray(sValue) {
            var selectValue = sValue;
            var Obj = document.getElementById("seleTown");
            var arrLen = 0;
            var i = 0;
            var optText;
            var optValue;
            if (selectValue == "1") {
                arrLen = arrChengqu.length;
                Obj.options.length = 0;
                Obj.options.add(new Option('-- 请选择 --', '0'));
                for (i = 0; i < arrLen; i++) {
                    optText = arrChengqu[i][0];
                    optValue = arrChengqu[i][1];
                    Obj.options.add(new Option(optText, optValue));
                }
            }
            else if (selectValue == "2") {
                arrLen = arrZhongqu.length; Obj.options.length = 0;
                Obj.options.add(new Option('-- 请选择 --', '0'));
                for (i = 0; i < arrLen; i++) {
                    optText = arrZhongqu[i][0];
                    optValue = arrZhongqu[i][1];
                    Obj.options.add(new Option(optText, optValue));
                }
            }
            else if (selectValue == "3") {
                arrLen = arrDongqu.length; Obj.options.length = 0;
                Obj.options.add(new Option('-- 请选择 --', '0'));
                for (i = 0; i < arrLen; i++) {
                    optText = arrDongqu[i][0];
                    optValue = arrDongqu[i][1];
                    Obj.options.add(new Option(optText, optValue));
                }
            }
            else if (selectValue == "4") {
                arrLen = arrNanqu.length; Obj.options.length = 0;
                Obj.options.add(new Option('-- 请选择 --', '0'));
                for (i = 0; i < arrLen; i++) {
                    optText = arrNanqu[i][0];
                    optValue = arrNanqu[i][1];
                    Obj.options.add(new Option(optText, optValue));
                }
            }
            else if (selectValue == "5") {
                arrLen = arrXiqu.length; Obj.options.length = 0;
                Obj.options.add(new Option('-- 请选择 --', '0'));
                for (i = 0; i < arrLen; i++) {
                    optText = arrXiqu[i][0];
                    optValue = arrXiqu[i][1];
                    Obj.options.add(new Option(optText, optValue));
                }
            }
            else if (selectValue == "6") {
                arrLen = arrBeiqu.length; Obj.options.length = 0;
                Obj.options.add(new Option('-- 请选择 --', '0'));
                for (i = 0; i < arrLen; i++) {
                    optText = arrBeiqu[i][0];
                    optValue = arrBeiqu[i][1];
                    Obj.options.add(new Option(optText, optValue));
                }
            }
            else if (selectValue == "7") {
                Obj.options.length = 0;
                Obj.options.add(new Option('-- 请选择 --', '0'));
                Obj.options.add(new Option('集客', '34'));
            }
            else if (selectValue == "8") {
                Obj.options.length = 0;
                Obj.options.add(new Option('-- 请选择 --', '0'));
                Obj.options.add(new Option('内部客户', '35'));
            }
            else {
                Obj.options.length = 0;
                Obj.options.add(new Option('-- 请选择 --', '0'));
            }

        }
    </script>
</head>
<body style="margin: 0 0 0 0; background-color: #fff; border-left: solid 1px #54a6e2;">
    <form id="form1" runat="server" onsubmit="return inputValidate();">
    <div>
        <table id="weizhi" width="100%;" style="border: none 0;">
            <tr>
                <td style="height: 2px;">
                </td>
            </tr>
            <tr>
                <td style="border: solid 1px #9fd6ff; background-image: url('../images/snap3.jpg');
                    height: 24px; color: #0930a5;">
                    &nbsp;&nbsp;<img align="absmiddle" src="../images/doc3.gif" />&nbsp;&nbsp;当前位置：我的工单
                </td>
            </tr>
            <tr>
                <td style="height: 1px;">
                </td>
            </tr>
        </table>
        <table width="100%" border="0">
            <tr>
                <td>
                    <div style="border: solid 1px #9fd6ff; background-color: #f0f8ff">
                        <table style="width: 100%">
                            <tr>
                                <td style="width: 10px;">
                                </td>
                                <td>
                                    <table border="0" style="width: 100%">
                                        <tr>
                                            <td style="width: 105px; height: 24px;" align="left">
                                                工单号：
                                            </td>
                                            <td align="left" style="width: 300px;">
                                                <input type="text" runat="server" id="txtOrderNo" class="TextBox" style="width: 195px"
                                                    onchange="setCreateTime();" />
                                            </td>
                                            <td style="width: 105px; height: 24px;" align="left">
                                                业务类型：
                                            </td>
                                            <td align="left">
                                                <asp:DropDownList ID="ddlProduct" runat="server" CssClass="TextBox" Width="100px">
                                                </asp:DropDownList><asp:DropDownList ID="ddlOrderType" runat="server" CssClass="TextBox" Width="100px">
                                                </asp:DropDownList>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td style="width: 105px; height: 24px;" align="left">
                                                工单主题：
                                            </td>
                                            <td align="left" style="width: 300px;">
                                                <asp:TextBox ID="txtTitle" runat="server" CssClass="TextBox" Width="195px"></asp:TextBox>
                                            </td>
                                            <td style="width: 105px; height: 24px;" align="left">
                                                区域：
                                            </td>
                                            <td align="left">
                                                <select id="seleArea" runat="server" style="width: 100px;" class="TextBox" onchange="resetSelectByArray(this.value);">
                                                    <option value="0" selected="selected">-- 请选择 --</option>
                                                    <option value="1">城区</option>
                                                    <option value="2">中区</option>
                                                    <option value="3">东区</option>
                                                    <option value="4">南区</option>
                                                    <option value="5">西区</option>
                                                    <option value="6">北区</option>
                                                    <option value="7">集客</option>
                                                    <option value="8">内部客户</option>
                                                </select><select id="seleTown" runat="server" style="width: 100px;" class="TextBox"
                                                    name="seleTown">
                                                    <option value="0" title="-- 请选择 --">-- 请选择 --</option>
                                                </select>
                                                <input type="hidden" id="hidTown" runat="server" />
                                            </td>
                                        </tr>
                                        <tr>
                                            <td style="width: 105px; height: 24px;" align="left">
                                                接入方式：
                                            </td>
                                            <td align="left" style="width: 300px;">
                                                <asp:DropDownList ID="ddlAccessMode" runat="server" CssClass="TextBox" Width="200px">
                                                </asp:DropDownList>
                                            </td>
                                            <td style="width: 105px; height: 24px;" align="left">
                                                工单状态：
                                            </td>
                                            <td align="left">
                                                <asp:DropDownList ID="ddlStatus" runat="server" CssClass="TextBox" Width="200px">
                                                </asp:DropDownList>
                                            </td>
                                        </tr>
                                        <tr>
                                        <td>是否完成：</td>
                                        <td>
                                            <asp:RadioButton ID="rbYes" runat="server" Text="是" GroupName="a" />&nbsp;&nbsp;&nbsp;&nbsp;<asp:RadioButton ID="rbNo"
                                                runat="server" Text="否" GroupName="a" /></td>
                                        <td></td>
                                        <td></td>
                                        </tr>
                                        <tr>
                                            <td style="width: 105px; height: 24px;" align="left">
                                                派单时间_起：
                                            </td>
                                            <td align="left" style="width: 300px;">
                                                <input type="text" class="TextBox" id="txtSTART_DATE" style="width: 195px;" runat="server"
                                                    onfocus="WdatePicker({skin:'whyGreen',readOnly:'true'});" />
                                            </td>
                                            <td style="width: 105px; height: 24px;" align="left">
                                                派单时间_止：
                                            </td>
                                            <td align="left">
                                                <input type="text" class="TextBox" id="txtEND_DATE" runat="server" style="width: 195px;"
                                                    onfocus="WdatePicker({skin:'whyGreen',readOnly:'true'});" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                                <asp:Button ID="Button2" runat="server" CssClass="Button" Text="查  询" OnClientClick="return inputValidate();"
                                                    OnClick="btnSearch_ServerClick" />
                                            </td>
                                        </tr>
                                        <tr>
                                            <td style="height: 4px;" align="left" colspan="4">
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                        </table>
                        <table style="width: 100%">
                            <tr>
                                <td>
                                    <div style="border: solid 1px #9fd6ff; background-color: #d4f1f9; border-bottom: none;">
                                        <table style="width: 100%; font-family: Arial">
                                            <tr>
                                                <td style="height: 20px;">
                                                    &nbsp;&nbsp;<img alt="" align="absmiddle" src="../images/181.gif" />&nbsp; <strong>显示结果</strong>
                                                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;每页显示<asp:TextBox runat="server" ID="txtRow"
                                                        Width="30px" CssClass="TextBox"></asp:TextBox>行 &nbsp;&nbsp;<asp:Label ID="lblRowCount"
                                                            runat="server" Text=""></asp:Label>
                                                </td>
                                                <td style="width: 120px">
                                                </td>
                                            </tr>
                                        </table>
                                    </div>
                                    <div id="divgv" style="border: solid 1px #9fd6ff; background-color: #f0f8ff;">
                                        <table width="100%">
                                            <tr>
                                                <td style="width: 10px;">
                                                </td>
                                                <td>
                                                    <div id="gv" style="border: solid 1px #9fd6ff; overflow: scroll; width: 100%">
                                                        <input type="hidden" runat="server" id="hidRowCount" value="0" />
                                                        <asp:GridView ID="GridView1" runat="server" AllowPaging="True" CssClass="Table" EmptyDataText="[没有可显示的数据]"
                                                            AutoGenerateColumns="False" Width="2500px" AllowSorting="True" BorderStyle="Solid"
                                                            CellPadding="3" OnRowDataBound="GridView1_RowDataBound" OnPageIndexChanging="GridView1_PageIndexChanging"
                                                            OnRowCommand="GridView1_RowCommand" OnSorting="GridView1_Sorting" PageSize="15">
                                                            <PagerSettings FirstPageText="首页" LastPageText="末页" Mode="NextPreviousFirstLast"
                                                                NextPageText="下一页" PreviousPageText="上一页" />
                                                            <PagerTemplate>
                                                                <asp:Label ID="lblPage" runat="server" Text='<%# "共" + hidRowCount.Value  + "条记录&nbsp;&nbsp;第" + (((GridView)Container.NamingContainer).PageIndex + 1)  + "页/共" + (((GridView)Container.NamingContainer).PageCount) + "页" %> '></asp:Label>
                                                                &nbsp;<asp:LinkButton ID="lbnFirst" runat="Server" Text="首页" Enabled='<%# ((GridView)Container.NamingContainer).PageIndex != 0 %>'
                                                                    CommandName="Page" CommandArgument="First"></asp:LinkButton>
                                                                &nbsp;<asp:LinkButton ID="lbnPrev" runat="server" Text="上一页" Enabled='<%# ((GridView)Container.NamingContainer).PageIndex != 0 %>'
                                                                    CommandName="Page" CommandArgument="Prev"></asp:LinkButton>
                                                                &nbsp;<asp:LinkButton ID="lbnNext" runat="Server" Text="下一页" Enabled='<%# ((GridView)Container.NamingContainer).PageIndex != (((GridView)Container.NamingContainer).PageCount - 1) %>'
                                                                    CommandName="Page" CommandArgument="Next"></asp:LinkButton>
                                                                &nbsp;<asp:LinkButton ID="lbnLast" runat="Server" Text="末页" Enabled='<%# ((GridView)Container.NamingContainer).PageIndex != (((GridView)Container.NamingContainer).PageCount - 1) %>'
                                                                    CommandName="Page" CommandArgument="Last"></asp:LinkButton>
                                                                &nbsp;&nbsp;到第&nbsp;<asp:TextBox runat="server" ID="inPageNum" Width="50px" CssClass="TextBox"></asp:TextBox>&nbsp;页
                                                                &nbsp;<asp:Button ID="Button1" CommandName="go" runat="server" Text="GO" CssClass="Button" />
                                                                <br />
                                                            </PagerTemplate>
                                                            <PagerStyle BackColor="#C6E3F2" />
                                                            <HeaderStyle CssClass="gridtitle" />
                                                            <Columns>
                                                                <asp:TemplateField HeaderText="工单号" SortExpression="order_number">
                                                                    <ItemStyle HorizontalAlign="Left" Width="230px" />
                                                                    <ItemTemplate>
                                                                        <a href="#" title="点击查看工单详细信息" onclick="window.open('showOrder.aspx?id=<%# Eval("order_id") %>','','location=no,menubar=no,status=no,toolbar=no,resizable=yes,scrollbars=yes,width=1050,height=600');">
                                                                            <%# Eval("order_number")%></a>
                                                                    </ItemTemplate>
                                                                </asp:TemplateField>
                                                                <asp:BoundField DataField="order_status" HeaderText="工单状态" SortExpression="order_status">
                                                                    <ItemStyle HorizontalAlign="Left" Width="150px" />
                                                                </asp:BoundField>
                                                                <asp:BoundField DataField="area_name" HeaderText="区域" SortExpression="area_id">
                                                                    <ItemStyle HorizontalAlign="Left" Width="40px" />
                                                                </asp:BoundField>
                                                                <asp:BoundField DataField="town_name" HeaderText="镇区" SortExpression="town_id">
                                                                    <ItemStyle HorizontalAlign="Left" Width="50px" />
                                                                </asp:BoundField>
                                                                <asp:TemplateField HeaderText="工单主题" SortExpression="title">
                                                                    <ItemStyle HorizontalAlign="Left" />
                                                                    <ItemTemplate>
                                                                        <a href="#" title="点击查看工单详细信息" onclick="window.open('showOrder.aspx?id=<%# Eval("order_id") %>','','location=no,menubar=no,status=no,toolbar=no,resizable=yes,scrollbars=yes,width=1050,height=600');">
                                                                            <%# Eval("title")%></a>
                                                                    </ItemTemplate>
                                                                </asp:TemplateField>
                                                                <asp:BoundField DataField="access_mode" HeaderText="接入模式" SortExpression="access_mode">
                                                                </asp:BoundField>
                                                                <asp:BoundField DataField="name_remark" HeaderText="签收人" SortExpression="entry_person">
                                                                </asp:BoundField>
                                                                <asp:BoundField DataField="task_time" HeaderText="派单时间" SortExpression="task_time"></asp:BoundField>
                                                                <asp:BoundField DataField="checkIn_time" HeaderText="签收时间"></asp:BoundField>
                                                                <asp:BoundField DataField="finish_time" HeaderText="完成时间"></asp:BoundField>
                                                                <asp:BoundField DataField="customer_name" HeaderText="用户名称"></asp:BoundField>
                                                                <asp:BoundField DataField="task_initiator" HeaderText="派单人"></asp:BoundField>
                                                                <asp:BoundField DataField="task_dept" HeaderText="派单人部门"></asp:BoundField>
                                                                <asp:BoundField DataField="order_content" HeaderText="派单意见"></asp:BoundField>   
                                                            </Columns>
                                                            <AlternatingRowStyle BackColor="#f0f8ff" />
                                                        </asp:GridView>
                                                    </div>
                                                </td>
                                            </tr>
                                        </table>
                                    </div>
                                    <script type="text/javascript">
                                        document.getElementById("gv").style.width = document.documentElement.clientWidth - 50;
                                    </script>
                                </td>
                            </tr>
                        </table>
                    </div>
                </td>
            </tr>
        </table>
    </div>
    </form>
</body>
</html>
